


import { HashRouter as Hash, BrowserRouter as History, Route, Switch, Redirect } from "react-router-dom"
import { connect } from "react-redux"
import Login from "./logins/login"
// import  NotFound  from "./errorpage/404"
// import  BadService from "./errorpage/503"
// import  MainBox from "./main"
import React, { lazy, Suspense } from "react"
import Loading from "../utils/loading"


export function MainRouter() {
    return (
        <Hash>
            <Route component={RouterConfig} />
        </Hash>
    )
}

function RouterConfig() {
    return (
        <div className="layout">
            <Suspense fallback={Loading()} >
                <Switch>
                    <Route path="/" exact render={() => (<Redirect to="/login" />)} />
                    <Route path="/login" component={lazy(() => import('./logins/login'))} />
                    <Route path="/register" component={lazy(() => import('./logins/register'))} />
                    <Route path="/forgetpass" component={lazy(() => import('./logins/forgetpass'))} />
                    <Route path="/main/" component={lazy(() => import('./main'))} />
                    <Route path="/404" component={lazy(() => import('./errorpage/404'))} />
                    <Route path="/503" component={lazy(() => import('./errorpage/503'))} />
                    <Route component={() => (<Redirect to="/404" />)} />
                </Switch>
            </Suspense>
        </div>
    )
}